import { createRouter, createWebHistory } from 'vue-router'

import Layout from '@/Layout/index.vue'
import Home from '@/views/Home/index.vue'
import Detail from '@/views/Detail/index.vue'
import WriterCenter from '@/views/WriterCenter/index.vue'
import MyBooks from '@/views/WriterCenter/MyBooks/index.vue'
import ReviewList from '@/views/WriterCenter/ReviewList/index.vue'
import Write from '@/views/WriterCenter/Write/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      children: [
        {
          path: "",
          name: "home",
          component: Home
        }, {
          path: "detail",
          name: "detail",
          component: Detail
        }, {
          path: "writercenter",
          name: "writercenter",
          component: WriterCenter,
          children: [{
            path: "mybooks",
            name: "mybooks",
            component: MyBooks
          },
          {
            path: "reviewlist",
            name: 'reviewlist',
            component: ReviewList
          }, {
            path: "write",
            name: "write",
            component: Write
          }]
        }
      ]
    }],
  scrollBehavior(to, from, savedPosition) {
    return { top: 0, left: 0 }
  }
})

export default router
